<%--== Handlers ==--%> <%--login Opening Initialization directive @1-A0E75F14--%><%!

// //Workaround for JRun 3.1 @1-F81417CB

//login TextBox Handler Head @5-D581173C
    public class LoginloginTextBoxHandler implements ValidationListener {
//End login TextBox Handler Head

//login BeforeShow Method Head @5-46046458
        public void beforeShow(Event e) {
//End login BeforeShow Method Head

//login BeforeShow Method Tail @5-FCB6E20C
        }
//End login BeforeShow Method Tail

//login OnValidate Method Head @5-5F430F8E
        public void onValidate(Event e) {
//End login OnValidate Method Head

//login Required Validation @5-43BB97B9
        {
            Control cntrl = (Control)e.getSource();
            if (cntrl.getValue() == null) {
                cntrl.addError("The value in field " + cntrl.getCaption() + " is required.");
            }
        }
//End login Required Validation

//login OnValidate Method Tail @5-FCB6E20C
        }
//End login OnValidate Method Tail

//login TextBox Handler Tail @5-FCB6E20C
    }
//End login TextBox Handler Tail

//password TextBox Handler Head @6-6F6A872B
    public class LoginpasswordTextBoxHandler implements ValidationListener {
//End password TextBox Handler Head

//password BeforeShow Method Head @6-46046458
        public void beforeShow(Event e) {
//End password BeforeShow Method Head

//password BeforeShow Method Tail @6-FCB6E20C
        }
//End password BeforeShow Method Tail

//password OnValidate Method Head @6-5F430F8E
        public void onValidate(Event e) {
//End password OnValidate Method Head

//password Required Validation @6-43BB97B9
        {
            Control cntrl = (Control)e.getSource();
            if (cntrl.getValue() == null) {
                cntrl.addError("The value in field " + cntrl.getCaption() + " is required.");
            }
        }
//End password Required Validation

//password OnValidate Method Tail @6-FCB6E20C
        }
//End password OnValidate Method Tail

//password TextBox Handler Tail @6-FCB6E20C
    }
//End password TextBox Handler Tail

//Button_DoLogin Button Handler Head @3-24601090
    public class LoginButton_DoLoginButtonHandler implements ButtonListener {
//End Button_DoLogin Button Handler Head

//Button_DoLogin OnClick Method Head @3-A9885EEC
        public void onClick(Event e) {
//End Button_DoLogin OnClick Method Head

//Event OnClick Action Login @4-68E5E436
{
com.codecharge.util.Authenticator auth = com.codecharge.util.AuthenticatorFactory.getAuthenticator( e.getPage().getRequest() );
auth.setRequest( e.getPage().getRequest() );
auth.setResponse( e.getPage().getResponse() );
auth.invalidate();
if ( auth.authenticate( e.getComponent().getControl("login").getFormattedValue(), e.getComponent().getControl("password").getFormattedValue() ) ) {
String retLink = e.getPage().getHttpGetParams().getParameter("ret_link");
if (retLink != null) e.getPage().setRedirectString( retLink );
} else {
e.getParent().addError("Login or Password is incorrect.");
e.getPage().setRedirectString( null );
e.getComponent().getControl("password").setFormattedValue("");
}
}
//End Event OnClick Action Login

e.getPage().setRedirectString("main.jsp");
//Event OnClick Action Custom Code @7-44795B7A
/* -------------------------- *
 *  write your own code here  *
 * -------------------------- */
//End Event OnClick Action Custom Code

//Button_DoLogin OnClick Method Tail @3-FCB6E20C
        }
//End Button_DoLogin OnClick Method Tail

//Button_DoLogin BeforeShow Method Head @3-46046458
        public void beforeShow(Event e) {
//End Button_DoLogin BeforeShow Method Head

//Button_DoLogin BeforeShow Method Tail @3-FCB6E20C
        }
//End Button_DoLogin BeforeShow Method Tail

//Button_DoLogin Button Handler Tail @3-FCB6E20C
    }
//End Button_DoLogin Button Handler Tail

//Comment workaround @1-A0AAE532
%> <%
//End Comment workaround

//Processing @1-C0CF3E7D
    Page loginModel = (Page)request.getAttribute("login_page");
    Page loginParent = (Page)request.getAttribute("loginParent");
    if (loginModel == null) {
        PageController loginCntr = new PageController(request, response, application, "/login.xml", "ISO-8859-1" );
        loginModel = loginCntr.getPage();
        //if (loginParent != null) {
            //if (!loginParent.getChild(loginModel.getName()).isVisible()) return;
        //}
    ((TextBox)((Component)loginModel.getChild("Login")).getChild("login")).addValidationListener(new LoginloginTextBoxHandler());
    ((TextBox)((Component)loginModel.getChild("Login")).getChild("password")).addValidationListener(new LoginpasswordTextBoxHandler());
    ((Button)((Component)loginModel.getChild("Login")).getChild("Button_DoLogin")).addButtonListener(new LoginButton_DoLoginButtonHandler());
        loginCntr.process();
%>
<%
        if (loginParent == null) {
            if (loginModel.redirect()) return;
            loginModel.setCookies();
        } else {
            loginModel.redirect();
        }
    }
//End Processing

%>
